The present invention relates to a method of generating a waveform of a music, in which a microprocessor is utilized to execute a music tone generation program.
A music tone generating apparatus of the prior art is typically constituted of a player module (an automatic musical performance program) sequentially providing a MIDI (Musical Instrument Digital Interface) event in a timing as indicated by a music score, a driver module generating a control parameter in response to the MIDI event every time the MIDI event is a provided, and a sound source module or engine generating a music tone waveform based on the generated control parameter. Moreover, the driver module of the sound source module (hereafter, sound source driver) executes various tasks such as channel assignment and conversion of the control parameter in response to the entered MIDI event. Furthermore, the sound source driver loads the control parameter and issues an activating command (Note-On message) to a channel assigned to the relevant event. The sound source module is constituted of a hardware device such as a dedicated LSI (a large scale integrated circuit) and a DSP (a digital signal processor). Otherwise, the sound source module may be constituted of a software sound source, in which a CPU executes a program describing a music tone generation processing procedure.
As described above, the music tone generating apparatus is constituted of the player, the sound source driver and the sound source engine. A work load of these modules is not constant, but rather it is general to fluctuate greatly. For example, when many of the MIDI events occur in a short period, the work load to be processed by the player and the sound source driver becomes high. Especially, when many of the Note-On events are present concurrently, the work load to be processed by the sound source driver becomes high volume. In case of the Note-On event, the sound source driver searches a free channel to perform a channel assignment such that the searched free channel is assigned to the Note-On event for generating a music tone corresponding to the Note-On event. The search processing and truncate processing which are performed at this time are time-consuming and are large in work load. Furthermore, in case of the Note-On event, a tone color setting process is also performed in response to a key touch. Thus, when the Note-On events are present concurrently, the work load of the sound source driver processing becomes high volume. Moreover, in case that the sound source engine is constituted of a software module, when the number of concurrent music tones is great, the work load of the sound source engine becomes high.
The processing in the player, sound source driver and sound source module are described specifically by a timing chart of FIG. 9. The timing chart shows process timing of a conventional music tone generating apparatus. MIDI inputs M1 to M4 denote successive MIDI events, and are input at the timing shown by the arrows of downward direction, respectively. For example, these MIDI events are provided when the player or sequencer reads out a MIDI file to reproduce music notes at the timing designated in accordance with a music score contained in the MIDI file. Every time the MIDI input M1 to M4 is received, a high priority interrupt is generated to start MIDI processing. By the started MIDI processing, the MIDI input M1 to M4 is sequentially stored into an input buffer together with time data received.
In the sound source driver processing "a" and "b", the sound source driver receives the MIDI events stored in the input buffer to perform the channel assignment and generation of control parameters in response to the MIDI events. At this point, the control parameters generated are stored into a control parameter buffer.
Moreover, waveform generation processing A, B, . . . , E is started at a certain period of time t1, t2, . . . , t5, . . . , and the waveform generation processing is executed for generating a waveform of music tones by the sound source engine. Samples of the music tone waveform are successively generated on the basis of the control parameters read out from the control parameter buffer and loaded into the sound source engine.
In the waveform generation processing, a certain time period is defined as one frame. For example, in this waveform generation processing, drive of the sound source engine by the control parameter generated in the frame from the timing t1 to t2 is executed in the subsequent frame from the timing t2 to t3. In this subsequent frame, the music tone waveform responsive to the control parameter is generated in the form of a sequence of sample values arranged throughout one frame period. The music tone waveforms concurrently generated at active channels of the sound source engine are accumulated with one another. One frame of the music tone waveforms obtained consequently are reserved for reproduction by a reproduction device being constituted of a DAC (a digital to analogue converter) or the like.
Furthermore, in the waveform generation processing, the reproduction device reads out the music tone waveform a sample by sample from an output buffer every sampling period. For example, samples of the music tone waveform generated in the frame from the timing t2 to t3 are reproduced in the subsequent frame from the timing t3 to t4. Therefore, a delay time .DELTA.t from input of the MIDI event till actual sounding of the MIDI event becomes two frames at the shortest. Generation of the music tone waveform to be reproduced in the subsequent frame should be completed within the period of the current frame. Generally, one frame is defined as a time period of several milliseconds.
In general, the sound source driver is realized by allowing a CPU to execute the sound source driver program. The sound source driver processing is commenced basically at occurrence of music events such as Note-On event, Note-Off event and program change event. Therefore, as shown in FIG. 9, when a plurality of events M1 to M3 are entered substantially at a simultaneous time, the load of the sound source driver is increased suddenly. Therefore, upon concentrating of the events, the large load is imposed on the CPU executing the sound source driver processing. At the same time, it can be caused risks that an automatic musical performance program, a game program, an image processing program or the like which the CPU executes becomes impossible to run. Especially, when the sound source engine is constituted of the software and the number of music tones to be computed and synthesized by the software sound source are great, the load of the software sound source becomes high volume due to increase of the music tone waveforms to be generated. Due to a high number of concurrent music tones, the music events occur quite frequently, whereby the load to be processed by the sound source driver and the player becomes high volume inevitably. Therefore, there has been the risk that when the number of music tones to be computed in the software sound source is present in high volume, associated processing to generate the music tones is also increased. Such a situation actually reduces the computable number of music tones.
Usually, the software sound source has a capacity to sound thirty-two number of music tones simultaneously. Stated otherwise, the software sound source engine has the thirty-two number of channels. However, when the Note-On events concentrate at a short period, the major portion of the computation ability of the CPU comes to be consumed for the Note-On event processing being executed by the sound source driver. As a result, the computation ability of the CPU assigned to the software sound source is reduced, whereby the music tone waveforms of the entire thirty-two notes cannot be generated.
There has been a method for solving this problem. That is, when there is a margin in the work load of the CPU, the waveform of the music tone is generated in advance before the sound timing on the basis of the control parameter generated by the sound source driver. The waveform thus generated is stored in a waveform buffer for later reproduction. Then, at the sound timing, the waveform is read out from the waveform buffer for the reproduction. However, by this method, a mass-storage for the waveform buffer comes to be required for storing the waveform generated in advance. Moreover, in the midpoint of music performance, upon operation of a tone volume control, pan control and effect control, correcting of the music tone waveform becomes difficult, since the music tone waveform of each part or channel of the sound source has been already synthesized. For example, in order to effect the correction, the music tone waveform of sixteen parts should be stored in the waveform buffer independently from each other, whereby a further mass-storage waveform buffer is required.